import request from '@/utils/request'

// 查询业主信息列表
export function listOwner(query) {
  return request({
    url: '/owner/owner/list',
    method: 'get',
    params: query
  })
}

// 查询业主信息详细
export function getOwner(ownerId) {
  return request({
    url: '/owner/owner/' + ownerId,
    method: 'get'
  })
}

// 新增业主信息
export function addOwner(data) {
  return request({
    url: '/owner/owner',
    method: 'post',
    data: data
  })
}

// 修改业主信息
export function updateOwner(data) {
  return request({
    url: '/owner/owner',
    method: 'put',
    data: data
  })
}

// 删除业主信息
export function delOwner(ownerId) {
  return request({
    url: '/owner/owner/' + ownerId,
    method: 'delete'
  })
}

// 查询业主详细
export function getDetail(ownerId) {
  return request({
    url: `/owner/owner/detail/${ownerId}`,
    method: 'get'
  })
}

// 查询业主详细信息列表（分页）
export function getOwnerVoList (query) {
  return request({
    url: '/owner/owner/selectOwnerVoList',
    method: 'get',
    params: query
  })
}

//上传文件
export function uploadFile(data) {
  return request({
    url: '/owner/owner/upload',
    method: 'post',
    data: data
  })
}

//跳转到绑定业主页面
export function BindOwner(ownerId) {
  return request({
    url: '/views/resident/bindOwner/',
    method: 'get'
  })
}

// 新增业主
export function addOwnerWithUser(data) {
  return request({
    url: '/owner/owner/addOwnerWithUser',
    method: 'post',
    data: data
  })
}
// 下载业主模板
export function downloadOwnerModel(ownerList) {
  return request({
    url: `/owner/downloadOwnerModel/${ownerList}`,
    method: 'get',
    responseType: 'blob'  // 重要：指定响应类型为blob
  })
}



